

import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;

public class ManageFrame extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ManageFrame frame = new ManageFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ManageFrame() {
		//设置窗口标题
				setTitle("购物系统主界面");
				//设置窗体位置与大小
				setBounds(100, 100, 450, 300);
				//设置关闭操作的事件
				setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				//固定窗口大小
				setSize(800,600);
				//设置窗口的位置为居中显示
				setLocationRelativeTo(null);
				
				JMenuBar menuBar = new JMenuBar();
				setJMenuBar(menuBar);
				
				JMenu basicMenu = new JMenu("基本数据维护");
				basicMenu.setIcon(new ImageIcon("./images/base.png"));
				menuBar.add(basicMenu);
				
				JMenu categoryMenu = new JMenu("商品类别管理");
				categoryMenu.setIcon(new ImageIcon("./images/manager.gif"));
				basicMenu.add(categoryMenu);
				
				JMenuItem addgoodsMenuItem = new JMenuItem("商品类别添加");
				addgoodsMenuItem.setIcon(new ImageIcon("./images/add.png"));
				categoryMenu.add(addgoodsMenuItem);
				//跳转到添加商品页面
				addgoodsMenuItem.addActionListener(new ActionListener() {
					
					 @Override
						public void actionPerformed(ActionEvent e) {
						 WaresAddFrame frame=new WaresAddFrame();
							frame.setVisible(true);
					 }
				});
				
				JMenuItem categoryUpdateMenuItem = new JMenuItem("商品类别维护");
				categoryUpdateMenuItem.setIcon(new ImageIcon("./images/modify.gif"));
				categoryMenu.add(categoryUpdateMenuItem);
				categoryUpdateMenuItem.addActionListener(new ActionListener() {
					
					 @Override
						public void actionPerformed(ActionEvent e) {
						 CategoryUpdateFrame frame=new CategoryUpdateFrame();
							frame.setVisible(true);
					 }
				});
				
				JMenu goodsmanageMenu = new JMenu("商品管理");
				goodsmanageMenu.setIcon(new ImageIcon("./images/product manager.gif"));
				basicMenu.add(goodsmanageMenu);
				
				JMenuItem GoodsAddMenuItem = new JMenuItem("商品添加");
				goodsmanageMenu.add(GoodsAddMenuItem);
				GoodsAddMenuItem.addActionListener(new ActionListener() {
					
					 @Override
						public void actionPerformed(ActionEvent e) {
					    GoodsAddFrame frame=new GoodsAddFrame();
							frame.setVisible(true);
					 }
				});
				
				JMenuItem repairMenuItem = new JMenuItem("商品维护");
				goodsmanageMenu.add(repairMenuItem);
				repairMenuItem.addActionListener(new ActionListener() {
					
					 @Override
						public void actionPerformed(ActionEvent e) {
						 ProductMaintenanceFrame frame=new ProductMaintenanceFrame();
							frame.setVisible(true);
					 }
				});
				
				JMenuItem leaveMenuItem = new JMenuItem("退出系统");
				leaveMenuItem.setIcon(new ImageIcon("./images/exit.png"));
				basicMenu.add(leaveMenuItem);
				
				JMenu aboutusMenu = new JMenu("关于我们");
				aboutusMenu.setIcon(new ImageIcon("./images/about.png"));
				menuBar.add(aboutusMenu);
				
				JMenuItem mntmNewMenuItem_5 = new JMenuItem("关于我们");
				aboutusMenu.add(mntmNewMenuItem_5);
	}

}
